home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #1 / Amiga Plus CD - 1996 - No. 1.iso / pd / grafik / xfig_v1.7 / doc / format1.4 < prev    next >
Encoding:
Text File  |  1995-08-22  |  9.2 KB  |  286 lines

  1. NOTE: THIS FILE FORMAT IS OBSOLETE.  THIS DOCUMENT IS ONLY PROVIDED
  2.     FOR BACKWARD COMPATIBILITY AND INFORMATION.
  3.  
  4. The following is the format of fig output (fig 1.4).
  5.  
  6. (1) The very first line is a comment line containing the name and version:
  7.     #FIG 1.4
  8.  
  9.     The character # at the first column of a line indicates that the line
  10.     is a comment line which will be ignored.
  11.  
  12. (2) The first non-comment line consists of two numbers :
  13.  
  14.     int    fig_resolution        (pixels/inch)
  15.     int    coordinate_system    (1 : origin is at the lower left corner
  16.                      2 : Upper left)
  17.  
  18.     Fig_resolution is the resolution fig is using for the current file.
  19.     It may not be the same as screen resolution (which can be higher or
  20.     lower).  I assume that a pixel is square, therefore this number
  21.     represents drawing resolution in both direction.  I've experimented
  22.     with fig automatically changing this number according to the resolution
  23.     of the monitor it is running on (The screen resolution, width and height
  24.     in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  25.     I've found that for monitors with higher resolution but same size
  26.     (19" diagonal), I preferred using the pixels for other things than
  27.     having fig occupying most of the screen.  Thus I opted for a fixed
  28.     pixel-per-inch number which make fig window smaller on higher resolution
  29.     monitor (than the standard sun monitor).  This however may change in
  30.     the future version.
  31.  
  32. (3) The rest of the file contains various objects.  An object can be one
  33.     of six classes (or types).
  34.  
  35.       i)    Arc.
  36.      ii)    Ellipse which is a generalization of circle.
  37.     iii)    Polyline which includes polygon and box.
  38.      iv)    Spline which includes closed/open control/interpolated spline.
  39.       v)    Text.
  40.      vi)    Compound object which is composed of one or more objects.
  41.  
  42.     In the following elaboration on object formats, every value of fig
  43.     output are separated by blank characters or new line ('\n').  The
  44.     value of the not-used parameters will be -1.
  45.  
  46.     A number of values are described as unused or not applicable to some
  47.     object even though they are defined for those objects.  These value
  48.     will (hopefully) be used in the future version of fig.  The intention
  49.     of their uses are the following.
  50.  
  51.     Value            Usage
  52.     -----            -----
  53.     area_fill    The stipple pattern (which will be align) for
  54.             filling object internals.  For example, an filled
  55.             arc will look like a piece of pie.
  56.  
  57.     pen        This will be a structure defining the shape of
  58.             pen used in drawing objects.  It also includes
  59.             the the stipple pattern for line filling.
  60.             The default pen is a circular pen with black
  61.             filling.
  62.  
  63.     thickness    Every pen has the thickness of one.
  64.             Thickness scales the size of a pen. 
  65.  
  66.     depth        This value adds a half dimension to fig.
  67.             It is useful when we have overlapping filled
  68.             objects and we want one to obliterate another.
  69.             An object can have only one depth (including
  70.             compound object).  An object that is in less
  71.             depth can obscure the one with greater depth
  72.             if they overlap.
  73.     
  74.     line_style    Only polyline (including polygon and box) can
  75.             be rendered with dashed line.  However the
  76.             objects created when the dash-line mode was on
  77.             will be recorded as such.  Currently the filter
  78.             f2ps (1) is able to render the desired line style
  79.             effect on hard copy.  Three line styles are defined.
  80.  
  81.                 0 : SOLID_LINE
  82.                 1 : DASH_LINE
  83.                 2 : DOTTED_LINE
  84.  
  85.     style_val    For dash style, it is the length of a dash.
  86.             For dotted line it indicates the approximated
  87.             gap of consecutive dots. 
  88.  
  89.     (3.1) ARC
  90.  
  91.     First line :
  92.     type    name            (brief description)
  93.     ----    ----            -------------------
  94.     int    object_code        (always 5)
  95.     int    sub_type        (always    1)
  96.     int    line_style        (See the end of this section)
  97.     int    line_thickness        (pixels, not used)
  98.     int    color            (not used)
  99.     int    depth            (not used)
  100.     int    pen            (not used)
  101.     int    area_fill        (not used)
  102.     float    style_val        (pixels, not used)
  103.     int    direction        (0 : clockwise, 1 : counterclockwise)
  104.     int    forward_arrow        (0: no forward arrow, 1: on)
  105.     int    backward_arrow        (0: no forward arrow, 1: on)
  106.     float    center_x, center_y    (center of the arc)
  107.     int    x1, y1            (pixels, the 1st point the user entered)
  108.     int    x2, y2            (pixels, the 2nd point)
  109.     int    x3, y3            (pixels, the last point)
  110.  
  111.     Forward arrow line (Optional; absent if forward_arrow is 0) :
  112.     type    name            (brief description)
  113.     ----    ----            -------------------
  114.     int    arrow_type        (not used)
  115.     int    arrow_style        (not used)
  116.     int    arrow_thickness        (not used)
  117.     int    arrow_width        (pixels)
  118.     int    arrow_height        (pixels)
  119.  
  120.     Backward arrow line (Optional; absent if backward_arrow is 0) :
  121.     type    name            (brief description)
  122.     ----    ----            -------------------
  123.     int    arrow_type        (not used)
  124.     int    arrow_style        (not used)
  125.     int    arrow_thickness        (not used)
  126.     int    arrow_width        (pixels)
  127.     int    arrow_height        (pixels)
  128.  
  129.     (3.2) COMPOUND
  130.  
  131.     A line with object code 6 signifies the start of a compound.
  132.     There are four more numbers on this line which indicate the
  133.     upper right corner and the lower left corner of the bounding
  134.     box of this compound.  A line with object code -6 signifies
  135.     the end of the compound.  Compound may be nested.
  136.  
  137.     First line :
  138.     type    name            (brief description)
  139.     ----    ----            -------------------
  140.     int    object_code        (always 6)
  141.     int    upperright_corner_x    (pixels)
  142.     int    upperright_corner_y    (pixels)
  143.     int    lowerleft_corner_x    (pixels)
  144.     int    lowerleft_corner_y    (pixels)
  145.  
  146.     Subsequent lines :
  147.     objects
  148.     .
  149.     .
  150.  
  151.     Last line :
  152.     -6
  153.  
  154.     (3.3) ELLIPSE
  155.  
  156.     First line :
  157.     type    name            (brief description)
  158.     ----    ----            -------------------
  159.     int    object_code        (always 1)
  160.     int    sub_type        (1 : ellipse defined by radiuses
  161.                      2 : ellipse defined by diameters
  162.                      3 : circle defined by radius
  163.                      4 : circle defined by diameter)
  164.     int    line_style        (See the end of this section)
  165.     int    thickness        (pixels, not used)
  166.     int    color            (not used)
  167.     int    depth            (not used)
  168.     int    pen            (not used)
  169.     int    area_fill        (not used)
  170.     float    style_val        (pixels, not used)
  171.     int    direction        (always 1)
  172.     float    angle            (radian, the angle of the x-axis)
  173.     int    center_x, center_y    (pixels)
  174.     int    radius_x, radius_y    (pixels)
  175.     int    start_x, start_y    (pixels; the 1st point entered)
  176.     int    end_x, end_y        (pixels; the last point entered)
  177.  
  178.     (3.4) POLYLINE
  179.  
  180.     First line :
  181.     type    name            (brief description)
  182.     ----    ----            -------------------
  183.     int    object_code        (always 1)
  184.     int    sub_type        (1 : polyline, 2 : box, 3 : polygon)
  185.     int    line_style        (See the end of this section)
  186.     int    thickness        (pixels, not used)
  187.     int    color            (not used)
  188.     int    depth            (not used)
  189.     int    pen            (not used)
  190.     int    area_fill        (not used)
  191.     float    style_val        (pixels)
  192.     int    forward_arrow        (0: off, 1: on)
  193.     int    backward_arrow        (0: off, 1: on)
  194.  
  195.     Forward arrow line : same as ARC object
  196.  
  197.     Backward arrow line : same as ARC object
  198.  
  199.     Points line :
  200.     type    name            (brief description)
  201.     ----    ----            -------------------
  202.     int    x1, y1            (pixels)
  203.     int    x2, y2            (pixels)
  204.       .
  205.       .
  206.     int    xn, yn            (this will be the same as the 1st
  207.                     point for polygon and box)
  208.     int    x, y            (always 9999, 9999; marks the end of
  209.                     point for polygon and box)
  210.  
  211.     (3.5) SPLINE
  212.  
  213.     First line :
  214.     type    name            (brief description)
  215.     ----    ----            -------------------
  216.     int    object_code        (always 1)
  217.     int    sub_type        (1 : open spline
  218.                      2 : closed spline
  219.                      3 : open interpolated spline
  220.                      4 : closed interpolated spline)
  221.     int    line_style        (See the end of this section)
  222.     int    thickness        (pixels, not used)
  223.     int    color            (not used)
  224.     int    depth            (not used)
  225.     int    pen            (not used)
  226.     int    area_fill        (not used)
  227.     float    style_val        (pixels, not used)
  228.     int    forward_arrow        (0: off, 1: on)
  229.     int    backward_arrow        (0: off, 1: on)
  230.  
  231.     Forward arrow line : same as ARC object
  232.  
  233.     Backward arrow line : same as ARC object
  234.  
  235.     Points line : same as POLYLINE object
  236.  
  237.     Control points line (absent if sub_type is 1 or 2) :
  238.     Control points of interpolated spline.  There are two control
  239.     points for each knots.  A section i, of the spline is drawn
  240.     using Bezier cubic with the following four points:
  241.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  242.           i  i        i    i      i+1    i+1     i+1   i+1
  243.     For closed interpolated spline the last pair of control points,
  244.     (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  245.     (lx1,ly1) and (rx1,ry1) respectively.
  246.  
  247.     type    name            (brief description)
  248.     ----    ----            -------------------
  249.     float    lx1, ly1        (pixels)
  250.     float    rx1, ry1        (pixels)
  251.     float    lx2, ly2        (pixels)
  252.     float    rx2, ry2        (pixels)
  253.       .
  254.       .
  255.     float    lxn, lyn        (pixels)
  256.     float    rxn, ryn        (pixels)
  257.  
  258.     (3.6) TEXT
  259.     type    name            (brief description)
  260.     ----    ----            -------------------
  261.     int    object             (always 4)
  262.     int    sub_type        (0 : Left justified
  263.                      1 : Center justified
  264.                      2 : Right justified)
  265.     int    font             (not used)
  266.     int    font_size         (not used)
  267.     int    pen            (not used)
  268.     int    color            (not used)
  269.     int    depth            (not used)
  270.     int    angle            (radian, not used, the angle of the
  271.                     the base line of the string)
  272.     int    font_style        (not used)
  273.     int    height            (pixels)
  274.     int    length            (pixels)
  275.     int    x, y            (pixels, coordinate of the origin
  276.                      of the string.  If sub_type = 0, it is
  277.                      the lower left corner of the string.
  278.                      If sub_type = 1, it is the lower
  279.                      center.  Otherwise it is the lower
  280.                      right corner of the string.)
  281.     char    string[]        (ascii characters; starts after a blank
  282.                     character following the last number and
  283.                     ends before the character '\1'.  This
  284.                     character is not part of the string.
  285.                     Note that the string may contain '\n'.)
  286.